package com.jerry.api.controller;

import com.jerry.api.service.JAddressService;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Date: 2025/4/7 14:25
 * @Created: by 王永发
 * @Description: TestControllers
 */

@Api(tags = {"地址信息"})
@RestController
@RequestMapping("/api/address")
public class JAddressController {
    @Autowired
    JAddressService addressService;

    /**
     * 获取地区信息
     *
     * @param code 行政区代码
     * @return 当code为空时，返回所有省份
     * 当code不为空时且code属于省时, 返回所有市
     * 当code不为空时且code属于市时, 返回所有区/县
     */
    @GetMapping("/getAddress")
    public List getAddress(@Param("code") String code) {
        // 市辖区/市做特殊处理
        return addressService.getAddress(code);
    }
}



